<template>
  <div>
    <el-carousel trigger="click" :height="imgHeight">
      <el-carousel-item v-for="(item,index) in urls" :key="index">
        <el-image :src="urls[index]" ref="imgHeight" fit="fit" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  data () {
    return {
      imgHeight: '467px', // 667
      urls: [
        'https://resource.smartisan.com/resource/d31076215d3c9173775ee4ff9caa12ec.jpg',
        'https://resource.smartisan.com/resource/48bb3a265af0e79d3c59a8dd6964ed45.jpg',
        'https://resource.smartisan.com/resource/ca0350d37e2315f52f007a3975fdf7db.jpg',
        'https://resource.smartisan.com/resource/4352557894120ef7036736ada37ea5a6.png',
        'https://resource.smartisan.com/resource/f1f92f9d86961a2730ed37c2f98b650a.png',
        'https://resource.smartisan.com/resource/ae112f88ab4879a35bdb8a1f8be4e8b7.jpg',
      ],
    };
  },
  mounted () {
    // 动态获取 ，设置走马灯高度
    this.size();
  },
  methods: {
    size () {
      let that = this
      window.onresize = function temp () {
        that.imgHeight = that.$refs.imgHeight[0].$el.offsetHeight + 'px'
        console.log(that.imgHeight)
      }
    }
  }
}
</script>
